package ace.module.stock.core.impl.manager;

import ace.module.common.core.impl.manager.EntityOfAppManager;
import ace.module.stock.api.model.dto.WmsStockDto;
import ace.module.stock.api.model.input.WmsBizInitInput;
import ace.module.stock.api.model.input.WmsBizUniqueIdInput;
import ace.module.stock.core.impl.dao.entity.WmsApplication;
import ace.module.stock.core.impl.dao.entity.WmsStock;
import ace.module.stock.core.impl.dao.model.bo.WmsStockDetailSaveContextBo;
import java.util.List;

/**
 * 库存 spring data jdbc querydsl rsql manager.
 *
 * @author Caspar
 */
public interface WmsStockManager extends EntityOfAppManager<WmsStock, Long, WmsStockDto> {


  WmsStockDetailSaveContextBo assembleInitOrSetSaveListContext(WmsApplication wmsApplication, WmsBizInitInput wmsBizInitInput);

  WmsStockDto findDtoByBizUniqueId(List<WmsStockDto> wmsStockDtos, WmsBizUniqueIdInput bizUniqueIdInput);

  void initOrSet(WmsApplication wmsApplication, WmsBizInitInput data);

  WmsStock getParentStock(Long wmsAppId, Long objectParentId);

  WmsStockDto getParentStockDto(Long wmsAppId, Long objectParentId);

  List<WmsStock> getChildrenStocks(Long wmsAppId, Long objectParentId);

  List<WmsStockDto> getChildrenStockDtos(Long wmsAppId, Long objectParentId);

  List<WmsStock> getSkuByWmsAppIdAndObjectIdIn(Long wmsAppId, List<Long> objectIds);

  List<WmsStockDto> getSkuDtoByWmsAppIdAndObjectIdIn(Long wmsAppId, List<Long> objectId);

  List<WmsStock> getProductByObjectIdIn(Long wmsAppId, List<Long> objectIds);

  List<WmsStockDto> getProductDtoByObjectIdIn(Long id, List<Long> data);

  /**
   * 获取库存节点本身与节点所有上级库存
   */
  List<WmsStock> getSkuStockAndAllRecursionParentStocksByWmsAppIdAndObjectIdIn(Long wmsAppId, List<Long> objectIds);

  List<WmsStock> getSkuStocksFromList(List<WmsStock> wmsStocks);

  void checkNotContainsAllWmsStockByObjectId(List<WmsStock> skuStockAndAllRecursionParentStocks, List<Long> objectIdInputs);

  List<Long> getIdsFromList(List<WmsStock> skuStockAndAllRecursionParentStocks);

  List<WmsStock> getSkuStockAndAllRecursionParentStocksByWmsAppIdAndSkuWmsStockIdIn(Long wmsAppId, List<Long> skuWmsStockIds);

  List<WmsStock> getByWmsAppIdAndBizUniqueIdIn(Long wmsAppId, List<WmsBizUniqueIdInput> wmsBizUniqueIdInputs);

  List<WmsStockDto> getDtoByWmsAppIdAndBizUniqueIdIn(Long wmsAppId, List<WmsBizUniqueIdInput> wmsBizUniqueIdInputs);
}